// fetchImage.mjs

import fetch from 'node-fetch';
import fs from 'fs';


async function fetchAndSaveJson() {
  try {
    const response = await  fetch("https://spa4.scrape.center/api/news/?limit=10&offset=0", {
      "headers": {
        "Referer": "https://spa4.scrape.center/",
        "Referrer-Policy": "strict-origin-when-cross-origin"
      },
      "body": null,
      "method": "GET"
    });

    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }

    const data= await response.json();
 
    console.log(data);
  } catch (error) {
    console.error('获取出错:', error.message);
  }
}


fetchAndSaveJson();
